﻿using System.Runtime.CompilerServices;

namespace csharp基础;

class 数据类型
{   
     void SwitchAndCase()
    {
        int my = int.Parse(Console.ReadLine());
        string str;
        while (my != 5)
        {   
            switch (my)
            {
                case 1: str = "Abc"; break;
                case 2: str = "Bcd"; break;
                case 3: str = "Cde"; break;
                case 4: str = "Def"; break;
                default: str = "Error"; break;
            }
            Console.WriteLine(str);
        }
    }

    
    #region 枚举的声明,和使用
    /// <summary>
    /// 枚举用来练习switch case
    /// </summary>
    //枚举的声明,不能在方法体内
    public enum EPlayerType{
        Main,
        Other,
        all
    }
    
    static void EnumTest() {
        EPlayerType eMain = EPlayerType.Main;
        EPlayerType eOhter = EPlayerType.Other;
        EenumStudy eStudent = EenumStudy.student;
        Console.WriteLine("Hello, enum!"+eMain);
        switch (eMain)
        {
            case EPlayerType.Main:
                Console.WriteLine("Hello, enum!"+eMain);
                break;
            case EPlayerType.Other:
                Console.WriteLine("Hello, enum!" + eStudent);
                break;
        }
    }

    #endregion

    #region 枚举的类型转换
    static void EnumToOther()
    {
            
    }
    #endregion

    /*static void Main(string[] args)
    {
        /*数据类型 c = new 数据类型();
        c.SwitchAndCase();#1#
        Console.WriteLine("Hello, c#基础!");
        
        EnumTest();
        
        
    }*/
}
        